package com.ruoyi.common.handleExeption;

import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.servlet.http.HttpServletResponse;

public class handleExeptionApp {

    @ExceptionHandler(Exception.class)
    public String handleExeption(HttpServletResponse response,Exception ex) {
        //response.setStatus(301);
        response.setHeader("Content-Security-Policy", "default-src 'self'; script-src 'self' 'unsafe-inline' cdn.example.com");
//
//
        response.setHeader("x-content-type-options","nosniff");
        //response.setHeader("x-frame-options","DENY");
        response.setHeader("x-xss-protection","1; mode=block");
        System.out.println("抛异常了:" + ex);
        ex.printStackTrace();
        String resultStr = "异常：NumberFormatException";
        return resultStr;
    }
}
